package org.itheima.game

import javafx.scene.input.KeyCode
import javafx.scene.input.KeyEvent
import javafx.scene.paint.Color
import org.itheima.kotlin.game.core.Composer
import org.itheima.kotlin.game.core.Painter
import org.itheima.kotlin.game.core.Window
import java.awt.print.PrinterAbortException

class MyWindow : Window() {
    override fun onCreate() {

    }

    override fun onDisplay() {
        Painter.drawImage("img/tank_u.gif",200,200)
        Painter.drawColor(Color.WHITE,20,20,100,100)
        Painter.drawText("cmj",30,30)

    }

    override fun onKeyPressed(event: KeyEvent) {
        when (event.code) {
            KeyCode.ENTER -> {

            }
            KeyCode.L->{
                Composer.play("snd/blast.wav")
            }
        }
    }

    override fun onRefresh() {
    }
}